1. Field of the Invention
The present invention relates to a signal level adjusting apparatus, a gain value updating method, and a program.
2. Description of the Related Art
In the playback process for music, it is usual that the input signal is amplified with a gain of a gain value according to the level of the signal and the amplified signal is outputted. For example, in MP3 (MPEG Audio Layer-3) players, when consecutively playing back MP3 files of different audio recording levels, dynamic range control, auto-gain control, and the like are performed in order that sound volume does not change much when switching the files. See, for example, Japanese Patent Application Laid-Open Publication No. 2003-46353.
As such, in a signal level adjusting apparatus that adjusts a signal level and outputs a signal, the gain value is updated according to the signal level of the input signal, but if the gain value is rapidly changed, playback sound volume will rapidly change or noise will occur. Hence, the gain value is updated such that the gain value approaches a target gain value stepwise.
FIG. 11 is a flow chart illustrating an example of a conventional procedure with which the gain value is updated by steps corresponding to a predetermined value. First, the signal level of the input signal (xi) is detected (S1101). Then, a gain value gt corresponding to the signal level is obtained (S1102). Note that the function f is a predefined function for obtaining the signal level of an output signal from the signal level of the input signal.
Then, if a current gain value ga is greater than the target gain value gt (S1103: YES), by multiplying the ga by a predetermined value α− (α−<1) or subtracting α− from ga, the ga is decreased by steps corresponding to α− (S1104). On the other hand, if a current gain value ga is smaller than the target gain value gt (S1105: YES), by multiplying the ga by a predetermined value α+ (α+>1) or adding α+ to ga, the ga is increased by steps corresponding to α+ (S1106). Then, the input signal is amplified with a gain of the updated value ga and outputted (S1107).
By updating the gain value ga by steps corresponding to predetermined values (α+, α−) as above, the gain value ga approaches the target gain value gt.
Here, because the ga is increased or decreased by a step corresponding to the predetermined value, by increasing the step size, the speed at which the ga converges on the gt can be increased. As shown in FIG. 12, however, if the step size is large, the ga oscillates without converging on the gt when the difference between the ga and the gt becomes small. If the gain value ga oscillates, the problem occurs that output sound oscillates or vibrates. On the other hand, by decreasing the step size, the ga can be prevented from oscillating, but the speed at which the ga converges on the gt becomes slow, and it takes a long time before starting to adjust the signal level with a gain of the gain value according to the signal level of the input signal.